home *** CD-ROM | disk | FTP | other *** search
- Using OPTION.COM
- notes on Edward Morris's "Errorlevel Made Easy" article in
- PC Magazine 16 February 1988 pp. 359-60
-
- To create a copy of OPTION.COM, put OPTION.SCR (another file ARCed with this
- one) on a disk with DEBUG.COM and use the command
-
- DEBUG < OPTION.SCR
-
- OPTION.COM prompts for and then tests keyboard input and returns errorlevels
- matched to the key pressed.
- Syntax:
-
- OPTION KE[KE][KE][KE][...][-prompt]
-
- where "KE" pairs are made up of
- K=keypress (any keyboard key; use + for ENTER/RETURN key)
- E=errorlevel code to be returned when paired K is pressed (number 0-9,
- then for 10 use :, for 11 use ;, for 15 use ?, and so on for higher
- values [follow sequence of ASCII characters after "9" but avoid
- characters like >, for 14, that DOS will attempt to execute])
- and where "-prompt" is an optional prompt message preceded by a hyphen.
-
-
- If an odd number of arguments (a broken pair) are specified on the command
- line, OPTION returns the last character as an errorlevel if any key except the
- one in the last valid pair is pressed (so OPTION A10 will return errorlevel 0
- if any key other than capital A is struck).
-
- EXAMPLE: [xx] in the example represents two spaces
-
- OPTION A1a1B2b2-Enter your choice: A or B?[xx]
-
- User is prompted: "Enter your choice: A or B?" and cursor is put two
- spaces after question mark.
-
- User presses A or a; OPTION returns errorlevel 1
- User presses B or b; OPTION returns errorlevel 2
- User presses some other key; OPTION beeps and waits for another try
-
-
- Changes:
-
- (Note: these changes apply to the original OPTION.COM only!! Included in this
- ARC file is another version of OPTION, called OPTIONQ. Do NOT try the patches
- below on OPTIONQ; they will work only on the original OPTION.COM.)
- (OPTIONQ.COM should be identical to OPTION.COM in operation with one exception:
- OPTIONQ does not beep when it first prompts for user input.)
-
- OPTION beeps to prompt for input or to reject illegal keys. To stop all
- the beeps, make the following patch:
-
- DEBUG OPTION.COM <enter>
- E 12A 90 90 <enter>
- W <enter>
- Q <enter>
-
- OPTION clears the screen and puts the cursor in the upper-left corner when
- it accepts a keypress. To display the key and move the cursor down a line
- instead, make the following patch:
-
- DEBUG OPTION.COM
- E151 B4 02 CD 21 B2 0D CD 21 B2 <enter>
- E15A 0A CD 21 58 B4 4C CD 21 <enter>
- RCX <enter>
- 62 <enter>
- W <enter>
- Q <enter>
-